package com.cpkf.util.iTextPDF;

import java.util.HashMap;
import java.util.Map;

/**
 * Element category enum, it is corresponding to the text template.
 *
 * @author Hyman Hu
 * @since  2014-6-23
 * Copyright SHOP.COM: all rights reserved worldwide
 */
public enum ElementCategory {
	
	Title (0, TextAnalyzeUtil.TITLE_SYMBOL_START), 
	Chapter (1, TextAnalyzeUtil.CHAPTER_SYMBOL_START), 
	Section (2, TextAnalyzeUtil.SECTION_SYMBOL_START), 
	Subsection (3, TextAnalyzeUtil.SUBSECTION_SYMBOL_START), 
	List (4, TextAnalyzeUtil.LIST_SYMBOL), 
	Table (5, TextAnalyzeUtil.TABLE_SYMBOL), 
	Anchor (6, TextAnalyzeUtil.ANCHOR_SYMBOL_START),
	Content (7, "");

	public Integer categoryId;
	public String symbol;
	
	private ElementCategory(Integer categoryId, String symbol) {
		this.categoryId = categoryId;
		this.symbol = symbol;
	}
	
	/**
	 * init enum to map
	 */
	public static Map<Integer, ElementCategory> categoryMap = new HashMap<Integer, ElementCategory>();
	static {
		for (ElementCategory elementCategory : ElementCategory.values()) {
			categoryMap.put(elementCategory.categoryId, elementCategory);
		}
	}

	/**
	 * get Element category by id
	 * 
	 * @param categoryId
	 * @return
	 */
	public static ElementCategory getElementCategory(Integer categoryId) {
		return categoryMap.get(categoryId);
	}
	
	public Integer getCategoryId() {
		return categoryId;
	}

	public String getSymbol() {
		return symbol;
	}

}
